<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript">
        function deng() {
            $.ajax({
                url:"/user/getInfo",
                type:"post",
                dataType:"json",
                data:$("#userId").serialize(),
                success:function (data) {
                    if (data.code == 0){
                        alert(data.msg)
                        location.href = "/user/toIndex"
                    }else {
                        alert(data.msg)
                    }
                },
                error:function (data) {
                    alert("sadasasd")
                }
            })
        }
        function code_img() {
            $("#img_id").attr("src","/code/vcode?time=" + new  Date().getTime())
        }
    </script>
<body>
<div th:insert="/commen/commen.html"></div>

<div class="container-fluid">
    <div class="panel panel-primary" style="width:400px">
        <div class="panel-heading">
            <h1>登录</h1>
        </div>
        <div class="panel-body">
            <form id="userId">
                <div class="form-group">
                    <label for="name">账号</label>
                    <input type="text" class="form-control" name="pname" id="name"
                           placeholder="请输入账号">
                    <div id="tips"></div>
                </div>
                <div class="form-group">
                    <label for="pwd">密码</label>
                    <input type="password" class="form-control" name="pwd" id="pwd">
                </div>
<!--                <div class="form-group">-->
<!--                    <label for="code">验证码</label>-->
<!--                    <input type="text" class="form-control" name="code" id="code" placeholder="请输入验证码">-->
<!--                    <img src="/code/vcode" id="img_id" width="150px" height="30px" onclick="code_img(this)"><br>-->
<!--                </div>-->
                <input type="button" class="btn btn-success btn-lg" value="登录" onclick="deng()">
                <a class="btn btn-danger" href="/user/toList">注册</a><br>
            </form>
        </div>
        <div class="panel-footer">
            <a href="#">忘记密码？</a>
        </div>
    </div>
</div>

</body>
</html>
